/*
 * @Description: 网关管理
 * @Date: 2023-11-20 11:32:57
 * @FilePath: \hksj-vued:\03code\hk-iot\src\api\configuration\gateway\index.ts
 */
import axiosRequest from '/@/utils/request';

export function useGatewayApi() {
  return {
    // ---网关品牌管理
    addBrand: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/brand/addBrand',
        method: 'POST',
        data: params,
      });
    },
    deleteBrand: async (id: string) => {
      return await axiosRequest({
        url: `/api/mqtt/brand/deleteBrand/${id}`,
        method: 'DELETE',
      });
    },
    updateBrand: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/brand/updateBrand',
        method: 'PUT',
        data: params,
      });
    },
    queryBrandByPaging: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/brand/queryBrandByPaging',
        method: 'POST',
        data: params,
      });
    },

    // ---网关管理
    // 新增网关
    addGateway: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/gateway/addGateway',
        method: 'POST',
        data: params,
      });
    },
    // 删除网关
    deleteGateway: async (id: string) => {
      return await axiosRequest({
        url: `/api/mqtt/gateway/deleteGateway/${id}`,
        method: 'DELETE',
      });
    },
    // 修改网关
    updateGateway: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/gateway/updateGateway',
        method: 'PUT',
        data: params,
      });
    },
    // 分页查询网关列表
    queryGatewayByPaging: async (params: object) => {
      return await axiosRequest({
        url: '/api/mqtt/gateway/queryGatewayByPaging',
        method: 'POST',
        data: params,
      });
    },

    // 查询所属机构下拉框
    listOrganization: async (params: {
      pageNum: number,
      pageSize: number,
      organName?: string
    }) => {
      return await axiosRequest({
        url: '/api/mqtt/gateway/listOrganization',
        method: 'POST',
        data: params,
      });
    },
    // 查询链接服务器下拉框
    listServer: async () => {
      return await axiosRequest({
        url: '/api/mqtt/gateway/listServer',
        method: 'GET',
      });
    },
  }
}
